<section class="content-header">
  <h1>
	用户管理
    <small>用户维护</small>
  </h1>
  <ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> 系统管理</a></li>
    <li class="active">用户管理</li>
  </ol>
</section>
<section class="content" xmlns:th="http://www.thymeleaf.org">
	<div class="row">
    	<div class="col-xs-12">
        	<div class="box">
	            <div class="box-body">
		            <form id="sysUserForm" role="form" class="form-horizontal">
		            	<div class="form-group ">
							<label class="control-label col-md-3">用户头像:</label>
							<div class="col-md-9">
								<div class="fileinput fileinput-new" data-provides="fileinput">
									<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px;">
										<img th:if="${sysUser?.userPhoto}" th:src="@{'/common/showImage?filePath='+${sysUser?.userPhoto}}"/>
									</div>
									<div>
										<span class="btn default btn-file">
											<span class="fileinput-new">选择图片</span>
											<span class="fileinput-exists">编辑</span>
											<input type="file" name="userPhoto">
										</span>
										<a href="javascript:;" class="btn red fileinput-exists" data-dismiss="fileinput">删除</a>
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
					        <label class="col-md-3 control-label">用户名:</label>
					        <div class="col-md-5">
					        	<input type="text" name="username" class="form-control" th:value="${sysUser?.username}" required="required" maxlength="50"/>
					        </div>
					    </div>
					    <div class="form-group">
					        <label class="col-md-3 control-label">姓名:</label>
					        <div class="col-md-5">
					        	<input type="text" name="name" class="form-control" th:value="${sysUser?.name}" required="required" maxlength="50"/>
					        </div>
					    </div>
					    <div class="form-group">
					        <label class="col-md-3 control-label">组织:</label>
					        <div class="col-md-5">
					        	<input type="hidden" id="orgId" name="orgId" th:value="${sysUser?.orgId}"/>
								<input type="text" class="form-control" id="orgName" name="orgName" required="required" onclick="showOrg()"
									readonly="readonly" th:value="${sysUser?.orgName}">
					        </div>
					    </div>
					    <div class="form-group">
						  	<label class="col-md-3 control-label">角色:</label>
						  	<div class="col-md-5">
						   		<select id="roleId" name="roleId" class="form-control select2" required="required" multiple>
						   			<option th:each="role : ${roleList}" th:value="${role?.id}" th:text="${role?.roleName}"
						   			 th:selected="${role?.userHas}"></option>
						   		</select>
						   		<input type="hidden" id="roleIds" name="roleIds"/>
						  	</div>
						</div>
					    <div class="form-group">
					        <label class="col-md-3 control-label">出生日期:</label>
					        <div class="col-md-5">
					        	<input type="text" id="birthday" name="birthday" class="form-control datepicker"
					        	th:value="${#dates.format(sysUser?.birthday, 'yyyy-MM-dd')}" required="required" maxlength="10" readonly="readonly"/>
					        </div>
					    </div>
					    <div class="form-group">
					        <label class="col-md-3 control-label">电话:</label>
					        <div class="col-md-5">
					        	<input type="text" name="phone" class="form-control" th:value="${sysUser?.phone}" required="required" maxlength="11"/>
					        </div>
					    </div>
					  	<div class="form-group">
					        <label class="col-md-3 control-label">邮箱:</label>
					        <div class="col-md-5">
					        	<input type="text" name="email" class="form-control" th:value="${sysUser?.email}" required="required" maxlength="50"/>
					        </div>
					    </div>
					  	<div class="form-group">
					        <label class="col-md-3 control-label">备注:</label>
					        <div class="col-md-5">
					        	<textarea rows="5" name="description" class="form-control" th:text="${sysUser?.description}" maxlength="255"></textarea>
					        </div>
					    </div>
					    <input type="hidden" name="id" th:value="${sysUser?.id}">
		            </form>
	            </div>
	            <div class="box-footer">
	            	<div class="col-md-9 col-md-offset-3">
						<button type="button" class="btn btn-primary" onclick="save()">保存</button>
			          	<button type="button" class="btn btn-default" onclick="forwardPage('/sysUser/init')">取消</button>
			        </div>
	            </div>
	        </div>
		</div>
	</div>
	<div class="modal fade" id="orgModal" tabindex="-1" role="basic" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
					<h4 class="modal-title">所属组织</h4>
				</div>
				<div class="modal-body">
					 <ul id="orgTree" class="ztree" style="margin-top:0; width:160px;"></ul>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" onclick="saveParentOrg()">确定</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<script th:src="@{/js/system/sysUser/sysUser.js}"></script>
</section>